import os
import unittest
from cases.Base_Case import BASECASE
from config.config import DATA_PATH
from page.index import IndexPage
from page.住院护士站.住院护士站.chuyuan__page import chuyuan
from page.住院护士站.住院护士站.yizhuxinxi__page import yizhuxinxi
from page.住院护士站.住院护士站.zhuyuanhushizhan__page import zhuyuanhushizhan
from tools.sjqd_way import read_data_from_excel
class TestZhuyuanhushizhan_Chuyuan(BASECASE):
    @classmethod
    def setUpClass(cls):
        ap = IndexPage()
        ap.jrym_no1('住院护士站')
    @classmethod
    def tearDownClass(cls):
        ap = IndexPage()
        ap.close_all_xxk()
        print("{}执行完毕-------------------------------------------------".format(cls))
    # 停止长期医嘱
    # @unittest.skip
    def test_1_zhuyuanhushizhan_tingchangqiyizhu(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "测试患者")
        name = self.data[0][0]
        bp = zhuyuanhushizhan()
        cp = yizhuxinxi()
        bp.input_hzxx(name)  # 输入住院患者姓名
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "执行医嘱")
        bq, ks, yzfl, yzzt, yz1, yz2 = self.data[0]
        bp.choose_bq(bq)  # 选择病区
        bp.click_cx_btn()  # 点击查询按钮
        bp.click_yzxx()  # 点击医嘱信息
        cp.click_cqyz()  # 点击长期医嘱
        cp.click_zxyz_btn()  # 点击执行医嘱
        cp.click_zx_btn()  # 点击执行按钮
        cp.click_wxts_s()  # 点击提示是
        cp.close_window_yzzx()  # 关闭医嘱执行窗口
        cp.close_window_yzxx()  # 关闭医嘱信息窗口
    #出院
    # @unittest.skip
    def test_2_zhuyuanhushizhan_chuyuan(self):
        bp = zhuyuanhushizhan()
        cp = chuyuan()
        bp.click_cy()#点击出院
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "出院")
        cyzt,lyfs,zzyjh= self.data[0]
        cp.choose_cyzt(cyzt)
        cp.choose_lyfs(lyfs)
        cp.choose_zzyjh(zzyjh)
        cp.all_click()
        cp.click_cy()
if __name__ == '__main__':
    unittest.main()
